import React, { useState } from "react";
import ChatRoom from "./ChatRoom";

const CharRoomApp: React.FC = () => {
  const [roomId, setRoomId] = useState("general");

  return (
    <>
      <label>
        选择聊天室：
        <select value={roomId} onChange={e => setRoomId(e.target.value)}>
          <option value="general">一般</option>
          <option value="travel">旅游</option>
          <option value="music">音乐</option>
        </select>
      </label>
      <hr />
      <ChatRoom roomId={roomId} />
    </>
  );
};
export default CharRoomApp;
